<template>
    <div class="container">
        <div>
            <Swipper></Swipper>
        </div>
        <div class="big-box">
            <div class="tab-header">
                <div class="tab-header-son">
                    <div class="tab-header-son-1" @click="tabClick(0)" :class="{ tab2: myTab == 0 }">关注
                        <div :class="fixClass == 0 ? 'fix' : ''"></div>
                    </div>
                    <div class="tab-header-son-1" @click="tabClick(1)" :class="{ tab2: myTab == 1 }">推荐
                        <div :class="fixClass == 1 ? 'fix' : ''"></div>
                    </div>
                </div>
            </div>
            <div class="line"></div>
            <!-- 渲染两种情况 -->
            <div class="content-main" v-if="btnTab == 0">
                <div class="content-main-son" v-for="item in guan" :key="item.id">
                    <div class="content-main-img">
                        <img :src="item.ranges.image" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                      {{item.ranges.introduction}}
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                {{item.ranges.pnum}}人
                            </div>
                        </div>
                    </div>
                </div>
                <!-- <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(2).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div> -->
            </div>
            <!-- 渲染第二种 -->
            <div class="content-main" v-else-if="btnTab == 1">

                <div class="content-main-son" v-for="item in commentMy" :key="item.id">
                    <div class="content-main-img">
                        <img :src="item.image" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        {{item.name}}
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                               {{ item.pnum }}人
                            </div>
                        </div>
                    </div>
                </div>
                <!-- <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-main-son">
                    <div class="content-main-img">
                        <img src="./../../assets/imgs/实验卡片／配图／1(1).png" alt="">
                    </div>
                    <div class="content-main-text" :class="{ shadow: myShadow == 0 }">
                        有效绕过黑名单检测，尝试连接，寻找...
                        <div class="content-main-text-bottom">
                            <div class="content-main-text-bottom-1">
                                恶意代码
                                <img src="./../../assets/imgs/icon_zuijiandan.png" alt="">
                            </div>
                            <div class="content-main-text-bottom-2">
                                122人
                            </div>
                        </div>
                    </div>
                </div> -->

            </div>
        </div>
    </div>
</template>

<script lang='ts' setup>
import { reactive, ref, onMounted } from 'vue'
import Swipper from "./../../component/Swipper/Swipper.vue"
import { collectApi,commentApi } from "./../../api/users.js";

const btnTab = ref<number>(0);
const fixClass = ref<number>(0);
const myShadow = ref<number>(0);
const myTab = ref<number>(0);

const commentMy=ref([])
const guan=ref([])
const ge=ref('')
onMounted(() => {
    collectData();
    commentData();
})
function collectData() {
    collectApi({
        "page": 1,
        "size": 10
    })
        .then((res: any) => {
            guan.value=res.data.data.data
        }).catch((err)=>{ 
            console.log(err);
            
        })
}
function commentData(){
    commentApi()
    .then((res)=>{
        // console.log(res.data.data);
        ge.value=res.data.data.length
        commentMy.value=res.data.data
    })
}

function tabClick(v: number) {
    // if(){

    // }
    btnTab.value = v;
    fixClass.value = v;
    myTab.value = v
}
</script>

<style lang='scss' scoped>
html,
body {
    padding: 0;
    margin: 0;
}

.big-box {
    width: 24rem;
    margin: 0 auto;
}

.container {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    box-sizing: border-box;
}

.tab-header {
    height: 1.125rem;
    display: flex;
    justify-content: center;
    align-items: center;

    .tab-header-son {
        width: 20%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;

        .tab-header-son-1,
        .tab-header-son-2 {
            width: 50%;
            height: 100%;
            line-height: 1.125rem;
            text-align: center;
            font-size: 0.25rem;
        }

        .tab-header-son-1 {
            color: #7f7f7f;
            font-weight: bold;
            position: relative;

            // border-bottom-color: red;
            // border-bottom-style: solid;
            // border-bottom-width: 0.025rem;
            .fix {
                width: 0.325rem;
                height: 0.325rem;
                border-bottom: 0.0625rem solid #139dff;
                position: absolute;
                bottom: -0.0375rem;
                left: 1.0375rem;
            }

        }

        .tab2 {
            color: #222222;
            font-weight: bold;
        }
    }
}

.line {
    border: 0.0125rem solid gray;
    margin-bottom: 0.5rem;
}

.content-main {
    min-height: 1.875rem;
    // display: flex;
    // justify-content: space-between;
    // align-items: center;
    // flex-wrap: wrap;
    display: grid;
    grid-template-columns: repeat(4, 20%);
    grid-column-gap: 1.51rem;
    .content-main-son {
        width: 5.0125rem;
        height: 4.25rem;
        margin-bottom: 0.275rem;
    //    margin-right: 0.94rem;
        border-radius: 0.125rem;
        border: 0.0125rem solid rgb(206, 204, 204);
        
        .content-main-img {
            width: 100%;
            height: 70%;

            img {
                width: 100%;
                height: 100%;
            }
        }

        .content-main-text {
            width: 100%;
            height: 30%;
            padding: 0.1rem;
            box-sizing: border-box;
            font-size: 0.1875rem;
            font-weight: bold;

            .content-main-text-bottom {
                display: flex;
                justify-content: space-between;
                align-items: center;
                width: 100%;
                height: 0.375rem;
                font-size: 0.125rem;
                color: #d8d8d8;
                margin-top: 0.25rem;

                .content-main-text-bottom-1 {
                    display: flex;
                    align-items: center;

                    img {
                        margin-left: 0.1rem;
                    }
                }
            }
        }

    }
}


.shadow {
    box-shadow: 0.0375rem 0.0375rem 0.125rem 0.025rem #eeecec, -0.0375rem -0.0375rem 0.125rem 0.025rem #eeecec;
}
</style>